package com.yphone.ui.ysj.view;

import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.iiordanov.bVNC.App;
import com.iiordanov.bVNC.ConnectionBean;
import com.zzkj.yunphone.R;
import com.iiordanov.bVNC.RemoteCanvasActivity;
import com.iiordanov.bVNC.Utils;
import com.yphone.base.utils.SharepreferenceUtils;
import com.yphone.tools.SharepreferenConstants;
import com.yphone.ui.login.activity.LoginActivity;
import com.yphone.ui.login.manager.LoginManager;
import com.yphone.ui.login.respone.UserInfo;
import com.yphone.ui.pay.activity.PayActivity;
import com.yphone.ui.ysj.bean.RemoteConnectBean;
import com.yphone.ui.ysj.presenter.YSJAddDevecePresenter;
import com.yphone.utils.NetworkUtils;
import com.yphone.utils.ToastUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class YSJAddDeviceView extends LinearLayout {
    /* access modifiers changed from: private */
    public Context mContext;
    private TextView tvAdd;
    private YSJAddDevecePresenter ysjAddDevecePresenter;

    public YSJAddDeviceView(Context context) {
        super(context);
        this.mContext = context;
        initview();
        initdata();
        initlisten();
    }

    public YSJAddDeviceView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.mContext = context;
        initview();
        initdata();
        initlisten();
    }

    public YSJAddDeviceView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        initview();
        initdata();
        initlisten();
    }

    private void initlisten() {
        this.tvAdd.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (!LoginManager.getInstance().isLogin()) {
                    LoginActivity.toLoginActivity(YSJAddDeviceView.this.mContext);
                } else if (!NetworkUtils.isConnected()) {
                    ToastUtils.showLong((CharSequence) YSJAddDeviceView.this.mContext.getString(R.string.no_net));
                } else {
                    addRemoteDevices();
//                    canvasStart();
//                    String monthCardUrl = PresetManger.getInstance().getPayPage();
//                    if (!TextUtils.isEmpty(monthCardUrl)) {
//                        WXPayEntryActivity.toWXPayEntryActivity(YSJAddDeviceView.this.mContext, monthCardUrl, "", 0);
//                    }
                }
            }
        });
    }

    private void addRemoteDevices() {
        Intent intent = new Intent(getMycontext(), PayActivity.class);
        getMycontext().startActivity(intent);
    }
    private void initview() {
        LayoutInflater.from(getContext()).inflate(R.layout.view_ysj_add_device, this);
        this.tvAdd = (TextView) findViewById(R.id.index_phone_add_all_btn);
    }

    private void initdata() {
    }

    public Context getMycontext() {
        return this.mContext;
    }

//    private void ShowAddBatchDeviceDialog() {
//        AddBatchDeviceDialog.showDialog(this.mContext, new IAddBatchDeviceCallBack() {
//            public void addBatchDevice(int addOrderNum, long groupId) {
//                if (addOrderNum > PresetManger.getInstance().getAddOrderNum()) {
//                    ToastUtils.showLong((CharSequence) YSJAddDeviceView.this.mContext.getString(R.string.add_order_num_limit));
//                    return;
//                }
//                CommSmallLoadingDialog.showDialog(YSJAddDeviceView.this.mContext, YSJAddDeviceView.this.mContext.getString(R.string.request_ing), false);
//                OrderManager.getInstance().addBatchOrderRequest(addOrderNum, groupId);
//                AddBatchDeviceDialog.dissmissDialog();
//            }
//        });
//    }
}